const int num_threads = 4;
    pthread_t threads[num_threads];
    ThreadArgs args[num_threads];
    pthread_mutex_t mutex;
    
    pthread_mutex_init(&mutex, nullptr);
    
    int total_iterations = a->ordered_values.size();  // 通过a访问
    int chunk_size = total_iterations / num_threads;
    
    for (int i = 0; i < num_threads; i++) {
        args[i].a = a;                              // 传递segment指针
        args[i].guesses = &guesses;
        args[i].total_guesses = &total_guesses;
        args[i].start = i * chunk_size;
        args[i].end = (i == num_threads - 1) ? total_iterations : (i + 1) * chunk_size;
        args[i].mutex = &mutex;
        
        pthread_create(&threads[i], nullptr, thread_function, &args[i]);
    }
    
    for (int i = 0; i < num_threads; i++) {
        pthread_join(threads[i], nullptr);
    }
    
    pthread_mutex_destroy(&mutex);
}